import "./core/patch/patch";
import UIManage from "./core/gui/UIManage";
import Loading from "./moduleview/login/Loading";
import TimeManage from "./core/time/TimerManage";
import ContextModel from "./module/common/ContextModule";
import "./module/common/BuildAllUI"
import game from "./core/game";
import Context from "./core/context/Context";
import AppConfig from "./core/config/AppConfig";

export function main() {

	Laya.Resource.DEBUG = AppConfig.Debug;

	const _ = Context.Instance;
	const ctx = new ContextModel();

	game.get(TimeManage).run(Date.now());

	Laya.timer.loop(1000, ctx, ctx.updateSecond);
	Laya.timer.frameLoop(1, ctx, ctx.updateLoop);


	if (AppConfig.Debug) {
		window["game"] = game;
		window["appconfig"] = AppConfig;
	}

	onOpenGame();
}


//开始游戏
function onOpenGame() {
	game.get(UIManage).open(Loading);

}

